package demo;

class Student{
    private String name;
    private int age;

    private static String ClassRoom;
//实例代码块
{
    System.out.println("实例代码块被执行了");
}
//静态代码块
    static{
//    name = "Ghost";
    System.out.println("静态代码块被执行了");
}

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("构造Student(String name, int age)方法被执行了。。。");
    }

    public String toString() {
        return "Your name";
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
public class StarWars {
    public static void main(String[] args) {
        Student stu1 = new Student("Sandman",16);
        Student stu2 = new Student("Truck",18);
        System.out.println(stu1);
        System.out.println(stu2);
    }
}
